<?php

namespace App\Policies;

use App\Models\User;
use Helper;
use Illuminate\Auth\Access\HandlesAuthorization;

class UserPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * 列表
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function index(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user');
    }

    /**
     * 新增
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function create(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.create');
    }

    /**
     * 插入
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function store(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.store');
    }

    /**
     * 详情
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function show(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.show');
    }

    /**
     * 编辑
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function edit(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.edit');
    }

    /**
     * 修改
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function update(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.update');
    }

    /**
     * 删除
     * @param User $_user
     * @param User $_users
     * @return bool
     */
    public function destroy(User $_user, User $_users)
    {
        return Helper::isActions($_user, 'user.destroy');
    }

}
